using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace UserControls
{
    public partial class frmColorDataGrid : Form
    {
        public static Color cCaptionColor ;
        public static Color cHeaderColor ;
        public static Color cBackColor ;
        public static Color cAlternatingBackColor ;
        public static Color cBackgroundColor ;
        public static Color cForeColor ;
        public static Color cLineColor ;
        public static Color cSelectedColor;
        public static Color cCaptionForeColor;
        public static Color cHeaderForeColor;
        public static Color cSelectedBackColor;



        private Color cCaptionColorOld;
        private Color cHeaderColorOld;
        private Color cBackColorOld;
        private Color cAlternatingBackColorOld;
        private Color cBackgroundColorOld;
        private Color cForeColorOld;
        private Color cLineColorOld;
        private Color cSelectedColorOld;
        private Color cCaptionForeColorOld;
        private Color cHeaderForeColorOld;
        private Color cSelectedBackColorOld;


        public frmColorDataGrid()
        {
            InitializeComponent();
            this.Load += new EventHandler(frmColorDataGrid_Load);
        }

        void frmColorDataGrid_Load(object sender, EventArgs e)
        {
            this.btnCaptionColorView.BackColor = cCaptionColor;
            this.btnHeadColorView.BackColor = cHeaderColor;
            this.btnBackColorView.BackColor = cBackColor;
            this.btnAlternatingColorView.BackColor = cAlternatingBackColor;
            this.btnBackgroundColorView.BackColor = cBackgroundColor;
            this.btnForeColorView.BackColor = cForeColor;
            this.btnLineColorView.BackColor = cLineColor;
            this.btnSelectedColorView.BackColor = cSelectedColor;




                   this.cCaptionColorOld=cCaptionColor ;
                   this.cHeaderColorOld=cHeaderColor ;
                   this.cBackColorOld=cBackColor ;
                   this.cAlternatingBackColorOld=cAlternatingBackColor ;
                   this.cBackgroundColorOld=cBackgroundColor ;
                   this.cForeColorOld=cForeColor ;
                   this.cLineColorOld=cLineColor ;
                   this.cSelectedColorOld=cSelectedColor ;


        }

        private void btnCaptionColor_Click(object sender, EventArgs e)
        {
            
            ColorDialog dlg = new ColorDialog();
            dlg.ShowDialog();
            
            if (dlg.Color != null)
            {
                this.cCaptionColorOld = this.btnCaptionColorView.BackColor;
                this.btnCaptionColorView.BackColor = dlg.Color;
                cCaptionColor = dlg.Color;
            }
        }

        private void btnHeadColor_Click(object sender, EventArgs e)
        {
            ColorDialog dlg = new ColorDialog();
            dlg.ShowDialog();
            if (dlg.Color != null)
            {
                this.cHeaderColorOld  = this.btnHeadColorView.BackColor;
                this.btnHeadColorView  .BackColor = dlg.Color;
                cHeaderColor  = dlg.Color;
            }
        }

        private void btnBackColor_Click(object sender, EventArgs e)
        {
            ColorDialog dlg = new ColorDialog();
            dlg.ShowDialog();
            if (dlg.Color != null)
            {
                this.cBackColorOld = this.btnBackColorView.BackColor;
                this.btnBackColorView .BackColor = dlg.Color;
                cBackColor  = dlg.Color;
            }
        }

        private void btnAlternatingColor_Click(object sender, EventArgs e)
        {
            ColorDialog dlg = new ColorDialog();
            dlg.ShowDialog();
            if (dlg.Color != null)
            {
                this.cAlternatingBackColorOld  = this.btnAlternatingColorView .BackColor;
                this.btnAlternatingColorView .BackColor = dlg.Color;
                cAlternatingBackColor = dlg.Color;
            }
        }

        private void btnBackgroundColor_Click(object sender, EventArgs e)
        {
            ColorDialog dlg = new ColorDialog();
            dlg.ShowDialog();
            if (dlg.Color != null)
            {
                this.cBackgroundColorOld  = this.btnBackgroundColorView .BackColor;
                this.btnBackgroundColorView .BackColor = dlg.Color;
                cBackgroundColor = dlg.Color;
            }
        }

        private void btnForeColor_Click(object sender, EventArgs e)
        {
            ColorDialog dlg = new ColorDialog();
            dlg.ShowDialog();
            if (dlg.Color != null)
            {
                this.cForeColorOld = this.btnForeColorView.BackColor;
                this.btnForeColorView .BackColor = dlg.Color;
                cForeColor = dlg.Color;
            }
        }

        private void btnLineColor_Click(object sender, EventArgs e)
        {
            ColorDialog dlg = new ColorDialog();
            dlg.ShowDialog();
            if (dlg.Color != null)
            {
                this.cLineColorOld = this.btnLineColorView.BackColor;
                this.btnLineColorView.BackColor = dlg.Color;
                cLineColor = dlg.Color;
            }
        }

        private void btnSelectedColor_Click(object sender, EventArgs e)
        {
            ColorDialog dlg = new ColorDialog();
            dlg.ShowDialog();
            if (dlg.Color != null)
            {
                this.cSelectedColorOld = this.btnSelectedColorView.BackColor;
                this.btnSelectedColorView .BackColor = dlg.Color;
                cSelectedColor = dlg.Color;
            }
        }

        private void btnExit_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnCaptionColorNotChose_Click(object sender, EventArgs e)
        {
            this.btnCaptionColorView.BackColor = this.cCaptionColorOld;
            cCaptionColor = this.cCaptionColorOld;
        }

        private void btnHeadColorNotChose_Click(object sender, EventArgs e)
        {
            this.btnHeadColorView.BackColor = this.cHeaderColorOld ;
            cHeaderColor  = this.cHeaderColorOld ;
        }

        private void btnBackColorNotChose_Click(object sender, EventArgs e)
        {
            this.btnBackColorView.BackColor = this.cBackColorOld;
            cBackColor  = this.cBackColorOld;
        }

        private void btnAlternatingColorNotChose_Click(object sender, EventArgs e)
        {
            this.btnAlternatingColorView .BackColor = this.cAlternatingBackColorOld ;
            cAlternatingBackColor = this.cAlternatingBackColorOld;
        }

        private void btnBackgroundColorNotChose_Click(object sender, EventArgs e)
        {
            this.btnBackgroundColorView.BackColor = this.cBackgroundColorOld;
            cBackgroundColor = this.cBackgroundColorOld;
        }

        private void btnForeColorNotChose_Click(object sender, EventArgs e)
        {
            this.btnForeColorView.BackColor = this.cForeColorOld;
            cForeColor  = this.cForeColorOld;
        }

        private void btnLineColorNotChose_Click(object sender, EventArgs e)
        {
            this.btnLineColorView.BackColor = this.cLineColorOld;
            cLineColor  = this.cLineColorOld;
        }

        private void btnSelectedColorNotChose_Click(object sender, EventArgs e)
        {
            this.btnSelectedColorView.BackColor = this.cSelectedColorOld;
            cSelectedColor  = this.cSelectedColorOld;
        }
 
        private void btnDefaultAll_Click(object sender, EventArgs e)
        {
          this.btnCaptionColorNotChose_Click(sender,e);
          this.btnHeadColorNotChose_Click(sender,  e);
          this.btnBackColorNotChose_Click(sender,  e);
          this.btnAlternatingColorNotChose_Click(sender,  e);
          this.btnBackgroundColorNotChose_Click(sender,  e);
          this.btnForeColorNotChose_Click(sender,  e);
          this.btnLineColorNotChose_Click(sender,  e);
          this.btnSelectedColorNotChose_Click(sender, e);
          this.btnCaptionForeColorNotChose_Click (sender, e);
          this.btnHeadForeColor_Click(sender, e);
          this.btnSelectedBackColor_Click(sender, e);
         }

        private void btnCaptionForeColor_Click(object sender, EventArgs e)
        {
            ColorDialog dlg = new ColorDialog();
            dlg.ShowDialog();
            if (dlg.Color != null)
            {
                this.cCaptionForeColorOld  = this.btnCaptionForeColorView.BackColor;
                this.btnCaptionForeColorView.BackColor = dlg.Color;
                cCaptionForeColor  = dlg.Color;
            }
        }

        private void btnHeadForeColorNotChose_Click(object sender, EventArgs e)
        {
            this.btnHeadColorView .BackColor = this.cHeaderForeColorOld ;
            cHeaderForeColor = this.cHeaderForeColorOld;
        }

        private void btnHeadForeColor_Click(object sender, EventArgs e)
        {
            ColorDialog dlg = new ColorDialog();
            dlg.ShowDialog();
            if (dlg.Color != null)
            {
                this.cHeaderForeColorOld  = this.btnHeadForeColorView .BackColor;
                this.btnHeadForeColorView .BackColor = dlg.Color;
                cHeaderForeColor = dlg.Color;
            }
        }

        private void btnCaptionForeColorNotChose_Click(object sender, EventArgs e)
        {
            this.btnCaptionColorView.BackColor = this.cCaptionForeColorOld;
            cCaptionForeColor  = this.cCaptionForeColorOld;
        }

        private void btnSelectedBackColor_Click(object sender, EventArgs e)
        {
            ColorDialog dlg = new ColorDialog();
            dlg.ShowDialog();
            if (dlg.Color != null)
            {
                this.cSelectedBackColorOld  = this.btnSelectedBackColorView .BackColor;
                this.btnSelectedBackColorView  .BackColor = dlg.Color;
                cSelectedBackColor    = dlg.Color;
            }
        }

        private void btnSelectedBackColorNotChose_Click(object sender, EventArgs e)
        {
            this.btnSelectedBackColorView.BackColor = this.cSelectedBackColorOld;
            cSelectedBackColor = this.cSelectedBackColorOld;
        }

       
    }//end class
}//end name spacee